﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddLayout.aspx.cs" Inherits="ZX.WebApp.Crm.Sale.AddLayout" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
     <title></title>
    <style type="text/css">
        body
        {
             background-color:#eeeeee;    
        }       
        .style80
        {
            border-bottom: black 1px solid;
            border-top-style: none;
            border-right-style: none;
            border-left-style: none;
            background-color: transparent;
            height: 14px;
            width: 95%;
        }
        .tableContent
        {
            width: 100%;
            border-collapse: collapse;
        }
        .tableContent td
        {
            border: solid 1px #D4DBE2;
            background-color: #F2F8FF;
            line-height: 22px;
        }
        .yui-skin-sam table {
	    width: 100%;
        } 
        .style81
        {
            width: 57px;
        }
        .style82
        {
            width: 86px;
        }
        .style83
        {
            width: 58px;
        }
        .style84
        {
            width: 199px;
        }
        .style85
        {
            width: 515px;
        }
         .style90
        {
            border-bottom: black 1px solid;
            border-top-style: none;
            border-right-style: none;
            border-left-style: none;
            background-color: transparent;
            height: 16px;
            width: 90%;
        }
        .style91
        {
            width: 177px;
        }
        hr {border:1px #cccccc dotted;}
        .style92
        {
            width: 57px;
            height: 27px;
        }
        .style93
        {
            width: 177px;
            height: 27px;
        }
        .style94
        {
            width: 86px;
            height: 27px;
        }
        .style95
        {
            height: 27px;
        }
        .style96
        {
            width: 58px;
            height: 25px;
        }
        .style97
        {
            width: 199px;
            height: 25px;
        }
        .style98
        {
            height: 25px;
        }/*Table样式end*/
.btnCheck
{ 
    border-right: #7b9ebd 1px solid; 
    padding-right: 2px; 
    border-top: #7b9ebd 1px solid; 
    padding-left: 2px; 
    font-size: 12px; 
    FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,  StartColorStr=#ffffff,  EndColorStr=#cecfde); 
    border-left: #7b9ebd 1px solid; 
    cursor: hand; 
    color: black; 
    padding-top: 2px; 
    border-bottom: #7b9ebd 1px solid; 
    height:22px;
}
    </style>   
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../../Styles/base.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/extend.validate.js" type="text/javascript"></script>
    <script src="../../Scripts/CombinButton.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/treeview/treeview-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
     
</head>
<body class="yui-skin-sam">
    <form id="form1" runat="server">
    <div>
         <table style="width: 100%" border="0.7" class="tableContent" >
            <tr>
                <td class="style92" align="center" >
                    填写人
                </td>
                <td class="style93" >
                    <input id="txtusername" runat="server" name="TrMessageIssueID" type="text" class="style80"
                        readonly="readonly" />
                </td>
                <td class="style94" align="center" >
                    填写时间
                </td>
                <td class="style95" >
                    <input id="txtaddtime" runat="server" name="MessageType1" type="text" class="style80"
                        readonly="readonly" size="20" />
                    <input type="hidden" id="type" name="type"  runat="server"  class="yui-dept"/>
                </td>
            </tr>
              <tr>               
                <td class="style92" align="center" >部门</td>
                <td id="style91"><input type="hidden" id="DeptID"  runat="server" name="DeptID" class="yui-dept"/>
                <input id="txtDeptID" name="txtDeptID" type="text" runat="server" readonly="readonly" value=""  class="yui-text" dtype="Z"   style="border-bottom: black 1px solid;
                        border-top-style: none; border-right-style: none; border-left-style: none; background-color: transparent; width:75%;
                        height: 14px;"/><button id="btnDeptID" name="G" runat="server"  type="button" value="" class="btnCheck" >选择</button></td>
                <td class="style82" align="center">
                    年份
                </td>
                <td >           
                             
                    <asp:DropDownList ID="ddlyear"  runat="server" AutoPostBack="false" > 
                    </asp:DropDownList>
                </td>
            </tr>
            </table>
    </div>
    <hr size="1" noshade="noshade" />
    <div>
       <table style="width: 100%" border="0.7" class="tableContent">
            <tr><td class="style83" align="center">月份</td><td class="style84">目标(金额/场次)元</td>
                <td class="style85" align="center">备注</td></tr>
            <tr><td class="style83" align="center">1</td>
                      <td class="style84" ><input id="TxtMonths1" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20"   onblur="mouseMove()"   /></td>
                        <td >
                            <input id="txtExplain1" runat="server" name="MessageType1" type="text" class="style90"    size="20" /></td>
        </tr>
                  <tr><td class="style83" align="center">2</td>
                      <td class="style84" ><input id="TxtMonths2" runat="server" name="MessageType1" 
                              type="text" class="style90"  size="20"  onblur="mouseMove()"  /></td>
                        <td >
                            <input id="txtExplain2" runat="server" name="MessageType1" type="text" class="style90" size="20" /></td>
        </tr>
                 <tr><td class="style83" align="center">3</td>
                      <td class="style84" ><input id="TxtMonths3" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20" onblur="mouseMove()"  /></td>
                        <td >
                            <input id="txtExplain3" runat="server" name="MessageType1" type="text" class="style90"  size="20" /></td>
        </tr>
                  <tr><td class="style83" align="center">4</td>
                      <td class="style84" ><input id="TxtMonths4" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20"  onblur="mouseMove()" /></td>
                        <td >
                            <input id="txtExplain4" runat="server" name="MessageType1" type="text" class="style90" size="20" /></td>
        </tr>
                  <tr><td class="style83" align="center">5</td>
                      <td class="style84" ><input id="TxtMonths5" runat="server" name="MessageType1" 
                              type="text" class="style90"  size="20" onblur="mouseMove()" /></td>
                        <td >
                            <input id="txtExplain5" runat="server" name="MessageType1" type="text" class="style90"  size="20" /></td>
        </tr>
                 <tr><td class="style83" align="center">6</td>
                      <td class="style84" ><input id="TxtMonths6" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20" onblur="mouseMove()"  /></td>
                        <td >
                            <input id="txtExplain6" runat="server" name="MessageType1" type="text" class="style90" size="20" /></td>
        </tr>
        <tr><td class="style83" align="center">7</td>
                      <td class="style84" ><input id="TxtMonths7" runat="server" name="MessageType1" 
                              type="text" class="style90"  size="20" onblur="mouseMove()" /></td>
                        <td >
                            <input id="txtExplain7" runat="server" name="MessageType1" type="text" class="style90" size="20" /></td>
        </tr>

        <tr><td class="style83" align="center">8</td>
                      <td class="style84" ><input id="TxtMonths8" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20" onblur="mouseMove()" /></td>
                        <td >
                            <input id="txtExplain8" runat="server" name="MessageType1" type="text" class="style90" size="20" /></td>
        </tr>
        <tr><td class="style83" align="center">9</td>
                      <td class="style84" ><input id="TxtMonths9" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20" onblur="mouseMove()" /></td>
                        <td >
                            <input id="txtExplain9" runat="server" name="MessageType1" type="text" class="style90" size="20" /></td>
        </tr>

        <tr><td class="style96" align="center">10</td>
                      <td class="style97" ><input id="TxtMonths10" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20" onblur="mouseMove()" /></td>
                        <td class="style98" >
                            <input id="txtExplain10" runat="server" name="MessageType1" type="text" class="style90" size="20" /></td>
        </tr>
        <tr><td class="style83" align="center">11</td>
                      <td class="style84" ><input id="TxtMonths11" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20" onblur="mouseMove()"  /></td>
                        <td >
                            <input id="txtExplain11" runat="server" name="MessageType1" type="text" class="style90" size="20" /></td>
        </tr>

        <tr><td class="style83" align="center">12</td>
                      <td class="style84" ><input id="TxtMonths12" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20"  onblur="mouseMove()"  /></td>
                        <td >
                            <input id="txtExplain12" runat="server" name="MessageType1" type="text" class="style90"  size="20" /></td>
        </tr>  
         <tr><td class="style83" align="center">&nbsp;总计</td>
                      <td class="style84" ><input id="TxtMonthsTotal" runat="server" name="MessageType1" 
                              type="text" class="style90" size="20" /></td>
                        <td ></td>
        </tr>  
       
       </table>
    </div><div id="dialog2" class="yui-pe-content">
        <div class="hd">
            所属业绩部门选择</div>
        <div class="bd">
            <iframe id="EditUIWindow2" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
    </form>
</body>
 <script type="text/javascript">

     function mouseMove() {
         var sumtotal;  
         sumtotal=0;
         for (var i = 1; i < 13; i++) {
             var txt1 = document.getElementById("TxtMonths" + i.toString());
             var value1 = txt1.value;
             if (value1 != null)
                 {
                     if (value1 != "") {
                            var re = /^[0-9]+.?[0-9]*$/;   //判断字符串是否为数字     //判断正整数 /^[1-9]+[0-9]*]*$/   
                            if (!re.test(value1))
                            {
                                alert("请输入数字");
                                txt1.focus();
                                return;
                             }
                            else
                            {
                                sumtotal = parseInt(sumtotal) + parseInt(value1);
                            }
                      }


                 }
              }
              if (sumtotal != 0) {
                  document.getElementById("TxtMonthsTotal").value = sumtotal;
              }
        } 
     
     function Save() {
         var Months;
         var explain;
        // var type = queryString("type");
         var deptid;
         var year;
         var type;
         if (deptid = "") {
             alert("部门不可以为空!");
         }
         else {
             type=document.getElementById("type").value;
             year = document.getElementById("ddlyear").value;
             deptid = document.getElementById("DeptID").value;
             Months = document.getElementById("TxtMonths1").value + "︾" + document.getElementById("TxtMonths2").value + "︾" + document.getElementById("TxtMonths3").value + "︾" + document.getElementById("TxtMonths4").value + "︾" + document.getElementById("TxtMonths5").value + "︾" + document.getElementById("TxtMonths6").value + "︾"
                 + document.getElementById("TxtMonths7").value + "︾" + document.getElementById("TxtMonths8").value + "︾" + document.getElementById("TxtMonths9").value + "︾" + document.getElementById("TxtMonths10").value + "︾" + document.getElementById("TxtMonths11").value + "︾" + document.getElementById("TxtMonths12").value;
             explain = document.getElementById("txtExplain1").value + "︾" + document.getElementById("txtExplain2").value + "︾" + document.getElementById("txtExplain3").value + "︾" + document.getElementById("txtExplain4").value + "︾" + document.getElementById("txtExplain5").value + "︾" + document.getElementById("txtExplain6").value + "︾"
                 + document.getElementById("txtExplain7").value + "︾" + document.getElementById("txtExplain8").value + "︾" + document.getElementById("txtExplain9").value + "︾" + document.getElementById("txtExplain10").value + "︾" + document.getElementById("txtExplain11").value + "︾" + document.getElementById("txtExplain12").value;
             var back = ZX.WebApp.Crm.Sale.AddLayout.Save(Months, type, deptid, explain, year).value;
             if (back != null) {
                 if (back = '1') {
                     alert('保存成功');
                     parent.closeWin();
                     parent.RefreshData();
                     parent.YAHOO.example.container.dialog1.hide();
                 }
                 else {
                     alert(back);
                 } 
             }
         }
     }
     YAHOO.namespace("example.container");
     YAHOO.util.Event.onDOMReady(function () {
        
         var handleCancel = function () {
             this.cancel();
         };
         var handleSubmit2 = function () {
             var editwindow = document.getElementById("EditUIWindow2");
             if (editwindow) {
                 editwindow.contentWindow.ChooseInfo();
             }
             YAHOO.example.container.dialog2.hide();
         };
        
         var handleSuccess = function (o) {
             var response = o.responseText;
             response = response.split("<!")[0];
             document.getElementById("resp").innerHTML = response;
         };
         var handleFailure = function (o) {
             alert("Submission failed: " + o.status);
         };
       
         YAHOO.example.container.dialog2 = new YAHOO.widget.Dialog("dialog2", {
             width: "360px",
             height: "350px",
             fixedcenter: true,
             visible: false,
             draggable: true,
             close: true,
             autofillheight: "body",
             constraintoviewport: true,
             buttons: [{ text: "确定", handler: handleSubmit2, isDefault: true },
			    { text: "取消", handler: handleCancel}]
         });
         
       
         YAHOO.example.container.dialog2.callback = { success: handleSuccess, failure: handleFailure };
         YAHOO.example.container.dialog2.render();
     });
   
     var _fn, _id;
     //业绩归属选择对应的方法和ID
     function ShowDialog2(fn, id) {
         _fn = fn;
         _id = id;
         YAHOO.example.container.dialog2.show();
     }
     //加载时统计总额
     $(function () {
         mouseMove(); 
     });
 </script>

</html>
